package com.water.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author wsj
 * @version 1.0
 * @description: TODO
 * @date 2022/1/11 22:08
 */
@Component
@Aspect
public class Aop {

    public void before(JoinPoint jp){
        System.out.println("======before====");
    }

    public void after(Object result){
        System.out.println("======after====result:"+result);
    }

    public void exception(JoinPoint jp,Throwable ex){

        System.out.println("======exception====");
    }

    public void myFinally(){
        System.out.println("======myFinally====");
    }

    public Object around(ProceedingJoinPoint pr) throws Throwable {

        System.out.println("======around之前====");
        Object proceed = pr.proceed();
        System.out.println("=======around之后=====");
        return proceed;
    }

}
